/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2022-09-24
 * Time:11:04
 */

class Count{
    public int count = 0;
    public synchronized void increase(){
        for (int i = 0; i < 50000; i++) {
            count++;
        }
    }
    public void increase2(){
        synchronized (Count.class){

        }
    }

    public synchronized static void method() {

    }
}

public class Demo {
    public static void main(String[] args) throws InterruptedException {
        Count c = new Count();

        synchronized (c){

        }




        Thread t1 = new Thread(() -> {
           c.increase();
        });
        Thread t2 = new Thread(() -> {
           c.increase2();
        });
        t1.start();
        t2.start();

        t1.join();
        t2.join();

        System.out.println("count = " + c.count);
    }
}
